package com.vehicle.mq.queue;

import com.vehicle.common.redis.manager.CacheManager;
import com.vehicle.common.util.Jsons;
import com.vehicle.mq.message.BaseMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Objects;

/**
 * Created by yantingbin on 2017/12/4.
 */
public class ProcessingQueue extends BaseMessageQueue {
    private static final Logger LOGGER = LoggerFactory.getLogger(ProcessingQueue.class);
    private static final String PROCESSING_QUEUE_NAME = "disruptor:processing";

    @Override
    public void push(BaseMessage baseMessage, EventQueue eq) {
        CacheManager cacheManager=eq.getCacheManager();
        cacheManager.lpush(PROCESSING_QUEUE_NAME,Jsons.toJson(baseMessage));
    }

    @Override
    public BaseMessage pop(EventQueue eq) {
        return null;
    }

    private ProcessingQueue() {

    }

    public static ProcessingQueue getInstance() {
        return Single.I;
    }

    private static class Single {
        private static final ProcessingQueue I = new ProcessingQueue();
    }
}
